package abstractions;

public interface HangmanSpecification {
	
	/**
	 * The maximum number of errors that a player can make before the game is over<br>
	 */
	 final int   ERROR_MAX = 10;
	 
	 /**
	  * The first alphabet character allowed in the word to be guessed
	  */
	 final char ALPHABET_FROM = 'a';
	 
	 /**
	  * The last alphabet character allowed in the word to be guessed
	  */
	 final char ALPHABET_TO = 'z';
	 
	 /**
	  * The size of the word alphabet
	  */
	 final int ALPHABET_SIZE='z'-'a'+1;
	 
	 /**
	  * True if:
	  * <ul>
	  * <li>  the first and last letters of the word alphabet are in correct alphabetic order,</li>
	  * <li>  the alphabet has at least 2 letters, </li>
	  * <li>  it is possible to have a losing  game because the 
	  *       alphabet is bigger than the allowed number of errors </li>
	  * <li>  the number of errors allowed is non-negative </li> 
	  * </ul>
	  * otherwise false
	  */
	 boolean INVARIANT_OF_CLASS = (ALPHABET_FROM < ALPHABET_TO && 
			                       ALPHABET_SIZE > ERROR_MAX &&
			                       ERROR_MAX >=0);
	 
	 
	 /**
	  * <pre>
	  * If letter already tried then do nothing and return
	  *    else add to letters tried
	  * If letter in word then add to letters found
	  *    else increment error count
	  * If all letters found then game ends with a win
	  * If all error guesses used up then ends game with a loss
	  * </pre>
	  * @param letter is the letter that the player thinks may be in the hangman word to be found
	  * @throws IllegalStateException if the letter is not in the alphabet of the word
	  * @throws IllegalArgumentException if the game is already over.
	  * 

      */
	 void tryLetter(char letter) throws IllegalStateException, IllegalArgumentException;

}
